package com.shelpe.services.sinbadgateway.configuration;

import java.util.HashMap;
import java.util.Map;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.Data;

@ConfigurationProperties(prefix="autoDrive")
@Data
public class AutoDriveProperties {

	private Map<String, Mode> modes = new HashMap<String, Mode>();
	
	public Mode findByName(String name){
		return this.modes.get(name);
	}
	
	public Mode findByValue(int value){
		Mode mode = null;
		
		for(Mode m: this.modes.values()){
			if(m.getValue() == value){
				mode = m;
				break;
			}
		}
		
		return mode;
	}
	
	@Data
	public static class Mode{
		private int peroid;
		private int value;
		private int pqrRatio;
	}
}
